package com.example.linktop.mytitlebar;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Toast;

/**
 * Created by linktoplinktop on 2017/6/20.
 */


public class TitleLayout extends LinearLayout{

    private Button btn_back, btn_edit;


    public TitleLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        //打气筒
        LayoutInflater.from(context).inflate(R.layout.my_title_bar, this);

        btn_back = (Button)findViewById(R.id.back_btn);
        btn_edit = (Button)findViewById(R.id.more_btn);

        btn_back.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                ((Activity)getContext()).finish();

            }
        });

        btn_edit.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(getContext(), "点击的edit", Toast.LENGTH_SHORT).show();;
            }
        });



    }




}
